import { Controller, Get, Post, HttpCode, Req, Request, Res, Query, Body } from '@nestjs/common';
import { AppService } from './app.service';
import { join } from 'path';
import { fstat } from 'fs';
import { response } from 'express';
//import { CacheService } from '@/servers/redis/cache/cache.service';
import { from } from 'rxjs';

@Controller()
export class AppController {
  constructor(
    private readonly appService: AppService,
    //private cacheService:CacheService
   ) {
    }

  /**
   * 测试获取列表
   */
  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  @Post('')
  async Upload(): Promise<any> {
    return '测试上传接口';
  }

  /**
   * 测试POST请求，返回Promise
   */
  // @Post('test')
  // async addUser(@Req() req): Promise<any> {
  //   console.log(req.headers.authorization);
  //   return  this.cacheService.get(req.session.token);
    
  // }

  /**
   * 测试POST请求，返回字符串
   */
  @Post('code')
  code(): string {
    return 'ABCD';
  }

}
